<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    body {
      padding: 100px 250px;
    }
    #tip{
      display: none;
      width: 300px;
      height: 50px;
      line-height: 50px;
      font-size: 30px;
      border: 1px  solid #ccc;
    }
  </style>
</head>
<body>
  <div>
    <div id="tip"></div>
    <input type="text">
  </div>
  <script>
    var tip = document.querySelector('#tip')
    var input = document.querySelector('input')

    input.onkeyup = function() {
      if( this.value === '' ) {
        tip.style.display = 'none'
      } else {
        tip.style.display = 'block'
        tip.innerText = this.value
      }
    }

    input.onblur = function(){
      tip.style.display = 'none'
    }
    input.onfocus = function(){
      if(this.value !== '') {
        tip.style.display = 'block'
      }
    }
  </script>
</body>
</html>